<template>
    <el-input v-model="value" :type="'text'"  @input="handleChange" @keydown.enter.native="handleEnter" ></el-input>
  </template>
  
  
  <script>
  export default {
    props:["type"],
    data() {
      return {
        value:''
      };
    },
    methods: {
      handleChange($event) {
        this.$emit("input", $event);
      },
      handleEnter($event) {
        this.findFatherTag(this.$parent, "el-card") &&
          this.findFatherTag(this.$parent, "el-card").$parent.$handleSearch();
      },
      findFatherTag(instance, tag) {
        if (!instance) return;
        if (
          instance.$options._componentTag &&
          instance.$options._componentTag == tag
        ) {
          return instance;
        }
        instance = instance.$parent;
        return this.findFatherTag(instance, tag);
      },
      clear(){
        this.value = ''
      }
    },
  };
  </script>
  
  
  <style lang="scss" scoped>
  input{
    height: 32px;
    line-height: 32px;
    outline: none;
    border: 1px solid #DCDFE6;
    padding: 0 15px;
    border-radius: 4px;
    color:#606266;
  }
  </style>